package com.briup.cms.dao;

import com.briup.cms.bean.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface CategoryMapper {
    @Results(
            @Result(column = "parent_id",property = "parentId")
    )

    @Select("select * from cms_category")
    List<Category> selectAll();

    @Insert("insert into cms_category values(null,#{name},#{introduce},#{nu},#{parentId})")
    void insert(Category category);

    @Update("update cms_category set name=#{name},introduce=#{introduce},nu=#{nu},parent_id=#{parentId} where id=#{id} ")
    void update(Category category);

    @Delete("delete from cms_category where id=#{id} ")
    void deleteById(long id);
}
